
#ifndef _MyCan_H
#define	_MyCan_H

#include <stdint.h>

#define CHARGER_STATUS_MESSAGE_BASE 0x18FF5000ul
#define CHARGE_COMMAND_MESSAGE_BASE 0x180600F4ul
#define TEMPERATURE_STATUS_MESSAGE_BASE 0x18123400ul
#define MASK_MATCH_IGNORE_SA 0x1fffff00ul
#define MASK_MATCH_IGNORE_SA_AND_DA 0x1fff0000ul
#define MASK_MATCH_ANYTHING 0x00000000ul

#define SID_FROM_FULL_ID(x) ((x) >> 18)
#define EID_FROM_FULL_ID(x) ((x) & 0x3fffful)


void SendCANMessage(uint32_t identifier, unsigned char* data, char bufferNumber);
unsigned int CAN1GetSID0();
uint32_t CAN1GetEID0();
unsigned char CAN1GetSA();
void InitializeCAN();

unsigned char ExtractSAFromEID(int EID);
uint32_t StitchDAIntoFullIdentifier(uint32_t id, unsigned char DA);
uint32_t StitchSAIntoFullIdentifier(uint32_t id, unsigned char SA);

int DoesSidEidMatchMessageBase();
int DoesIDMatchMessageBase_IgnoreSA(uint32_t ID, uint32_t messageBase);
int DoesIDMatchMessageBase_IgnoreSADA(uint32_t ID, uint32_t messageBase);


void MC_PrintCANStatus();

uint32_t CAN1GetRecieveExtendedID0();
char CAN1GetDLC0();


uint32_t CAN1GetRecieveExtendedID1();
char CAN1GetDLC1();



#endif	/* _MyCan_H */

